home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / util / dir / managers.lha / Managers / Dir / Dir.g < prev    next >
Text File  |  1997-01-15  |  7KB  |  361 lines

  1. G4C  ; Contains the 3 pop-up GUIS
  2.  
  3.  
  4. ; This is the RMB pop-up gui (i.e. pops up on clicking the Right Mouse Button)
  5.  
  6. WinBig 0 0 80 105 ""
  7. WinType 00001000
  8. winonmouse 30 22 
  9.  
  10. xOnRMB 
  11. guiclose Dir.g
  12.  
  13. xOnInactive
  14. guiclose Dir.g
  15.  
  16. xOnOpen                ; upon opening the window
  17. setvar mlv_id  $$LV_ID        ; get the listview's id
  18. if $mlv_id = 2            ; set the copy/move gadgets pointing
  19.    setgad Dir.g 1 HIDE            ; correctly according to the LV's id.
  20.    setgad Dir.g 2 HIDE
  21.    setgad Dir.g 11 show
  22.    setgad Dir.g 22 show
  23.    setvar mlv_destid 1          ; get the destination lv's id
  24.    setvar mlv_destdir $lv_dir1  ; and the destination dir (we'll need them)
  25. else
  26.    setgad Dir.g 11 HIDE
  27.    setgad Dir.g 22 HIDE
  28.    setgad Dir.g 1 show
  29.    setgad Dir.g 2 show
  30.    setvar mlv_destid 2
  31.    setvar mlv_destdir $lv_dir2
  32. endif
  33. redraw Dir.g
  34.  
  35.  
  36. xOnQuit
  37. delvar mlv_#?
  38.  
  39.  
  40. ;=============================== Next GUI button
  41.  
  42. xbutton 0 0 0 15 More..
  43. guiopen Dir.g3            ; open an other gui with more options
  44. guiclose Dir.g
  45.  
  46. ;=============================== copy button
  47.  
  48. xbutton 0 15 0 15 Copy->
  49. gadid 1
  50. gosub Dir.g copy
  51.  
  52. xbutton 0 15 0 15 <-Copy
  53. gadid 11
  54. gosub Dir.g copy
  55.  
  56. xroutine copy
  57. guiclose Dir.g
  58. lvaction copy dir.gc $mlv_id $mlv_destdir      ; copy all selected files/dirs
  59. lvdir dir.gc $mlv_destid refresh               ; refresh destination
  60.  
  61. ;============================= copy new files
  62.  
  63. xbutton 0 30 0 15 "Copy New"
  64. gadid 11
  65. guiclose Dir.g
  66. lvaction copynew dir.gc $mlv_id $mlv_destdir
  67. lvdir dir.gc $mlv_destid refresh
  68.  
  69.  
  70. ;=============================== Move 
  71.  
  72. xbutton 0 45 0 15 Move->
  73. gadid 2
  74. gosub Dir.g move
  75.  
  76. xbutton 0 45 0 15 <-Move
  77. gadid 22
  78. gosub Dir.g move
  79.  
  80. xroutine move
  81. guiclose Dir.g
  82. lvaction move dir.gc $mlv_id $mlv_destdir
  83. lvdir dir.gc $mlv_destid refresh
  84.  
  85.  
  86. ;============================== delete
  87.  
  88. xbutton 0 60 0 15 Delete
  89. gadid 3
  90. guiclose Dir.g
  91. lvaction delete dir.gc $mlv_id REQ
  92.  
  93.  
  94. ;============================= rename
  95. ; This routine reads the dir listview in the normal first/next method
  96. ; using the lvmulti command.
  97.  
  98. xbutton 0 75 0 15 Rename
  99. gadid 4
  100. if $$LV_DIR < " "                ; stop if it is the device list
  101.    stop
  102. endif
  103. lvmulti Dir.gc $mlv_id first     ; get the first record
  104. guiclose Dir.g
  105. guiload :Dir.ren
  106. guiopen Dir.ren
  107.  
  108. ;============================== makedir
  109.  
  110. xbutton 0 90 0 15 MakeDir
  111. gadid 5
  112. guiload :dir.makedir
  113.  
  114.  
  115. ;#########################################################################
  116.  
  117. NEWFILE dir.g2    ; This is the pop-up on double-click gui.
  118.  
  119. WinBig 0 0 80 90 ""
  120. WinType 00001000
  121. winonmouse 30 7 
  122.  
  123. xOnRMB 
  124. guiclose Dir.g2
  125.  
  126. xOnInactive
  127. guiclose Dir.g2
  128.  
  129. xOnFail
  130. ezreq "Error during operation" OK ""
  131.  
  132. ;---------------> the Buttons
  133.  
  134. xbutton 0 0 0 15 Auto
  135. guiclose dir.g2
  136. FILENAME = $lv_file
  137. rtn.option = 'run >nil:'
  138. gosub dir.view ViewFile
  139.  
  140. xbutton 0 15 0 15 List
  141. FILENAME = $lv_file
  142. guiload :dir.read
  143. guiopen dir.read
  144.  
  145. xbutton 0 30 0 15 Cli..
  146. cd $$LV_DIR
  147. guiclose dir.g2
  148. setvar cl_Main '$lv_file '
  149. guiopen dir.cli
  150. update  dir.cli 10 1    ; set it to CLI
  151.  
  152. xbutton 0 45 0 15 'Edit'
  153. guiclose dir.g2
  154. run '$DEF.EDITOR $lv_file'
  155.  
  156. xbutton 0 60 0 15 Execute
  157. guiclose dir.g2
  158. cli 'execute $lv_file'
  159.  
  160. xbutton 0 75 0 15 Rx
  161. guiclose dir.g2
  162. if $REXXOK != 1                 ; ****** Check for Arexx
  163.    guiload :rexxcheck.g
  164.    if $REXXOK != 1              ; quit if rexxcheck failed
  165.        stop
  166.    endif
  167. endif
  168. cli 'rx $lv_file'
  169.  
  170.  
  171. ;#########################################################################
  172.  
  173. NEWFILE dir.g3    ; The more.. gui (from the RMB pop-up gui)
  174.  
  175.  
  176. WinBig 0 0 160 105 ""
  177. WinType 00001000
  178. winonwin Dir.g 0 0 
  179.  
  180. xOnRMB 
  181. guiclose Dir.g3
  182.  
  183. xOnInactive
  184. guiclose Dir.g3
  185.  
  186. xOnOpen
  187. setvar mlv_id $$LV_ID     ; Get the id of the current lvdir
  188.  
  189. xOnClose
  190. setwintitle dir.g3 ""     ; because ezreq will change the wintitle..
  191.  
  192.  
  193. ;================================ buttons (left bank)
  194.  
  195. xbutton 0 0 40 15  <<        ; previous
  196. guiopen dir.g
  197. guiclose dir.g3
  198.  
  199. xbutton 40 0 40 15  >>        ; next
  200. guiopen dir.g4
  201. guiclose dir.g3
  202.  
  203. xbutton 0 15 80 15 View
  204. guiclose dir.g3
  205. rtn.option = ''
  206. mlv_id = $$LV_ID
  207. lvmulti dir.gc $mlv_id first
  208. while $lv_file > ""
  209.     FILENAME = $lv_file
  210.     gosub dir.view viewfile
  211.     lvmulti dir.gc $mlv_id next
  212. endwhile
  213.  
  214. xbutton 0 30 80 15 Protect
  215. guiclose dir.g3
  216. guiload  :dir.prot
  217. guiopen  dir.prot
  218.  
  219. xbutton 0 45 80 15 Size
  220. guiclose dir.g3
  221. lvaction SIZE dir.gc $mlv_id  lv_size
  222. ezreq 'Total size of files\n& dirs selected:\n$lv_size bytes.\n' OK ""
  223.  
  224. xbutton 0 60 80 15 Shell
  225. guiclose dir.g3
  226. cd $$LV_DIR
  227. run 'newshell "con:0/150/680/120/Gui4Cli/auto/close"'
  228.  
  229. xbutton 0 75 80 15 'CliGui'
  230. cd $$LV_DIR
  231. guiclose dir.g3
  232. setvar cl_Main ''
  233. guiopen dir.cli
  234. update  dir.cli 10 1    ; set it to CLI
  235.  
  236.  
  237. xbutton 0 90 80 15 Info
  238. ifexists file c:info
  239.   ;
  240. else
  241.   ezreq "Need the c:info command!" OK ""
  242.   stop
  243. endif
  244. cli 'c:info >ram:t/infofile'
  245. FILENAME = ram:t/infofile
  246. guiload :dir.read
  247. guiopen dir.read
  248.  
  249.  
  250. ; ------------------ Buttons right bank
  251.  
  252. xbutton 80  0 80 15 User..
  253. guiload :dir.user
  254. guiclose dir.g3
  255.  
  256. xbutton 80 15 80 15 Find
  257. guiclose dir.g3
  258. guiload :dir.find
  259. guiopen dir.find
  260.  
  261. xbutton 80 30 80 15 Search
  262. guiclose dir.g3
  263. guiload :dir.search
  264. guiopen dir.search
  265.  
  266. xbutton 80 45 80 15 Hex
  267. lvmulti dir.gc $$LV_ID first
  268. if $lv_file > ""
  269.    run '$DEF.HEX $lv_file'
  270. else
  271.    ezreq 'No file chosen' OK ""
  272. endif
  273.  
  274. xbutton 80 60 80 15 Config
  275. guiclose dir.g3
  276. guiload :dir.config
  277.  
  278. xbutton 80 75 80 15 Help
  279. extract dir.gc guipath lv_path
  280. joinfile $lv_path dir.guide lv_guide
  281. run '$DEF.GUIDE $lv_guide'
  282. delvar lv_path
  283. delvar lv_guide
  284.  
  285. xbutton 80 90 80 15 Quit
  286. guiclose dir.g3
  287. ezreq "QUIT ???!!.. Who, me ?\n" 'DIE!|Well..' lv_ask
  288. if $lv_ask = 1
  289.    guiquit dir.gc
  290. endif
  291.  
  292. ;#########################################################################
  293.  
  294. NEWFILE dir.g4    ; The more->more.. gui (from the RMB pop-up gui)
  295.                   ; Define your own functions here...
  296.  
  297. WinBig 0 0 160 105 ""
  298. WinType 00001000
  299. winonwin Dir.g3 0 0 
  300.  
  301. xOnRMB 
  302. guiclose Dir.g4
  303.  
  304. xOnInactive
  305. guiclose Dir.g4
  306.  
  307.  
  308. ;================================ buttons (left bank)
  309.  
  310. xbutton 0 0 80 15  <<
  311. guiopen dir.g3
  312. guiclose dir.g4
  313.  
  314. xbutton 0 15 80 15 Calc
  315. guiclose dir.g4
  316. guiload :dir.calc
  317.  
  318. xbutton 0 30 80 15 Lock
  319. guiclose dir.g4
  320. guiload :dir.lock
  321.  
  322. xbutton 0 45 80 15 PPShow
  323. guiclose dir.g4
  324. guiload :dir.ppshow
  325.  
  326. xbutton 0 60 80 15 Replace
  327. guiclose dir.g3
  328. guiload  :dir.rep
  329. guiopen  dir.rep
  330.  
  331. xbutton 0 75 80 15 GfxCon
  332. guiclose dir.g4
  333. guiload :dir.gfxcon
  334.  
  335. xbutton 0 90 80 15 Avail
  336. guiclose dir.g4
  337. guiload :dir.avail
  338.  
  339. ; ------------------ Buttons right bank
  340.  
  341. xbutton 80  0 80 15 'LHa Pack'
  342. guiclose dir.g4
  343. guiload :dir.lha
  344.  
  345. xbutton 80 15 80 15 ReWrap
  346. guiclose dir.g4
  347. guiload :dir.wrap
  348.  
  349. xbutton 80 30 80 15 ""
  350.  
  351. xbutton 80 45 80 15 ""
  352.  
  353. xbutton 80 60 80 15 ""
  354.  
  355. xbutton 80 75 80 15 ""
  356.  
  357. xbutton 80 90 80 15 ""
  358.  
  359.  
  360.  
  361.